Skip to content

Conversation

@rayudu3745
Copy link
Contributor

@rayudu3745 rayudu3745 commented Dec 11, 2025

This change introduces the initial setup required to execute Hibernate Spanner Dialect tests against the Cloud Spanner Emulator:
https://github.com/GoogleCloudPlatform/cloud-spanner-emulator

With this configuration in place, Spanner Dialect tests can now be executed locally by running:

./docker_db.sh spanner

./gradlew test -Pdb=spanner

At present, the test suite will not pass. There are multiple known gaps and incompatibilities in the current SpannerDialect implementation that prevent full test coverage from succeeding. These issues are expected and will be addressed incrementally in upcoming PRs, which will deliver fixes, behavioral corrections, and broader functional improvements.

This PR focuses solely on enabling the emulator-backed test environment so that future development and validation can occur consistently and locally.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19983

@sebersole
Copy link
Member

@beikov As the docker / container expert, wdyt?

@beikov
Copy link
Member

beikov commented Dec 12, 2025

This looks good already, but I wonder if we can enable parallelization as well, as I assume that the emulator will be "slower" probably?
Since databases are automatically created (apparently?), it might be as simple as changing the JDBC URL to jdbc:cloudspanner:/projects/orm-test-project/instances/orm-test-instance/databases/orm-test-db-$worker?autoConfigEmulator=true;lenient=true and adding the name of the database bundle to the if checks in hibernate-core.gradle and hibernate-envers.gradle. Search for GradleParallelTestingResolver in those files and you will find the place.

@rayudu3745 rayudu3745 force-pushed the spanner-testrun-setup branch from 11f1701 to 666f286 Compare December 15, 2025 05:47
@rayudu3745
Copy link
Contributor Author

Thanks for the suggestion, @beikov . I tried running the tests in parallel, but the Spanner emulator is currently crashing during the run due to an internal issue. We will coordinate with the spanner emulator team to identify the root cause and look into enabling parallel testing at a later date.

It is also worth noting that the emulator is significantly faster than a Cloud Spanner instance since it runs entirely in-memory. However, it currently suffers from a memory issue where resources from deleted tables are not properly garbage collected. We have reported this to the emulator team as well.

@beikov beikov merged commit 0d53890 into hibernate:main Dec 15, 2025
21 of 23 checks passed
@beikov
Copy link
Member

beikov commented Dec 15, 2025

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants